/* 移动端样式增强 */

/* 触摸反馈 */
.touch-feedback {
  position: absolute !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(14, 165, 233, 0.3) !important;
  pointer-events: none !important;
  z-index: 1000 !important;
  transform: translate(-50%, -50%) scale(0) !important;
}

/* 移动端通用样式 */
@media (max-width: 768px) {
  /* 触摸目标优化 */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 按钮增强 */
  button, .btn, .action-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 16px !important;
  }

  /* 输入框增强 */
  input, textarea, .ant-input {
    font-size: 16px !important; /* 防止iOS缩放 */
    min-height: 44px !important;
    padding: 12px 16px !important;
  }

  /* 链接增强 */
  a, .link {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 8px 12px !important;
  }

  /* 卡片间距调整 */
  .picture-card, .list-item, .category-tab {
    margin-bottom: 16px !important;
  }

  /* 滚动条隐藏 */
  ::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
  }

  /* 滚动优化 */
  .scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
  }

  /* 防止橡皮筋效果 */
  body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }

  /* 搜索框移动端优化 */
  .search-box {
    padding: 1rem !important;
    border-radius: 16px !important;
  }

  .search-input {
    font-size: 16px !important;
    padding: 12px 0 !important;
  }

  /* 导航菜单移动端优化 */
  .nav-menu {
    gap: 0.25rem !important;
    padding: 0.375rem !important;
  }

  .nav-item {
    padding: 12px 16px !important;
    min-height: 44px !important;
  }

  /* 侧边栏移动端优化 */
  .sider-content {
    padding-top: 1rem !important;
  }

  .menu-item {
    min-height: 48px !important;
    padding: 12px 16px !important;
    margin-bottom: 8px !important;
  }

  /* 图片列表移动端优化 */
  .picture-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 12px !important;
  }

  .picture-card {
    border-radius: 16px !important;
  }

  .image-container {
    height: 140px !important;
  }

  .card-content {
    padding: 12px !important;
  }

  /* 操作按钮移动端优化 */
  .action-buttons {
    gap: 12px !important;
  }

  .action-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 1rem !important;
  }

  /* 标签云移动端优化 */
  .tag-cloud {
    gap: 8px !important;
  }

  .tag-item {
    padding: 8px 12px !important;
    font-size: 0.875rem !important;
  }

  /* 分页移动端优化 */
  .pagination-container {
    margin-top: 2rem !important;
  }

  :deep(.ant-pagination) {
    text-align: center !important;
  }

  :deep(.ant-pagination-item),
  :deep(.ant-pagination-prev),
  :deep(.ant-pagination-next) {
    min-width: 40px !important;
    height: 40px !important;
    line-height: 38px !important;
  }

  /* 模态框移动端优化 */
  :deep(.ant-modal) {
    margin: 0 !important;
    max-width: 100% !important;
    top: 0 !important;
    padding-bottom: 0 !important;
  }

  :deep(.ant-modal-content) {
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  :deep(.ant-modal-body) {
    padding: 16px !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
  }

  /* 下拉菜单移动端优化 */
  :deep(.ant-dropdown-menu) {
    min-width: 200px !important;
    border-radius: 12px !important;
  }

  :deep(.ant-dropdown-menu-item) {
    min-height: 44px !important;
    padding: 12px 16px !important;
    line-height: 20px !important;
  }

  /* 消息提示移动端优化 */
  :deep(.ant-message) {
    top: 80px !important;
  }

  :deep(.ant-message-notice) {
    margin: 8px auto !important;
    max-width: calc(100vw - 32px) !important;
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  /* 头部优化 */
  .header-content {
    padding: 0 1rem !important;
  }

  .logo-container {
    width: 40px !important;
    height: 40px !important;
  }

  .loading-logo {
    width: 32px !important;
    height: 32px !important;
  }

  .title-main {
    font-size: 1rem !important;
  }

  /* 搜索区域优化 */
  .hero-section {
    padding: 1.5rem 0 2rem !important;
  }

  .hero-title {
    font-size: 2rem !important;
  }

  .search-container {
    margin-bottom: 1rem !important;
  }

  /* 筛选区域优化 */
  .category-tabs {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .category-tab {
    padding: 12px 16px !important;
  }

  /* 图片网格超小屏优化 */
  .picture-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .picture-card {
    border-radius: 12px !important;
  }

  .image-container {
    height: 120px !important;
  }

  .card-content {
    padding: 8px !important;
  }

  .picture-title {
    font-size: 0.875rem !important;
    -webkit-line-clamp: 1 !important;
  }

  /* 列表视图超小屏优化 */
  .list-item {
    flex-direction: column !important;
    text-align: center !important;
    padding: 12px !important;
  }

  .list-image {
    width: 60px !important;
    height: 60px !important;
    margin: 0 0 8px 0 !important;
  }

  .list-content {
    margin-bottom: 8px !important;
  }

  .list-meta {
    flex-direction: column !important;
    gap: 4px !important;
  }

  /* 底部导航优化 */
  .modern-footer {
    padding: 1rem 0 !important;
  }

  .footer-content {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    text-align: center !important;
    padding: 1rem !important;
  }

  /* 加载动画优化 */
  .loading-container {
    max-width: 280px !important;
    padding: 1rem !important;
  }

  .loading-rings {
    width: 80px !important;
    height: 80px !important;
  }

  .progress-container {
    margin: 1.5rem 0 1rem !important;
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    padding: 1rem 0 !important;
  }

  .hero-title {
    font-size: 1.8rem !important;
    margin-bottom: 0.5rem !important;
  }

  .hero-subtitle {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  .search-container {
    margin-bottom: 1rem !important;
  }

  .filter-section {
    margin-bottom: 1.5rem !important;
  }

  .loading-container {
    max-width: 300px !important;
  }

  .logo-container {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 1rem !important;
  }
}

/* 触摸设备特定样式 */
@media (hover: none) and (pointer: coarse) {
  /* 移除悬浮效果，使用点击效果 */
  .hover-lift:hover {
    transform: none !important;
  }

  .picture-card:hover {
    transform: none !important;
  }

  .nav-item:hover {
    transform: none !important;
    background: transparent !important;
  }

  .menu-item:hover {
    transform: none !important;
    background: transparent !important;
  }

  /* 为触摸设备添加点击效果 */
  .picture-card:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
  }

  .nav-item:active,
  .menu-item:active {
    background: rgba(14, 165, 233, 0.1) !important;
    transition: background 0.1s ease !important;
  }

  .action-btn:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
  }

  /* 简化动画 */
  * {
    transition-duration: 0.2s !important;
  }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
  .picture-card,
  .nav-item,
  .menu-item,
  .tag-item {
    transition: none !important;
    animation: none !important;
  }

  .loading-rings .ring {
    animation: none !important;
  }

  .particle {
    animation: none !important;
  }

  .skeleton-image,
  .skeleton-title,
  .skeleton-tag {
    animation: none !important;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .picture-card,
  .nav-item,
  .menu-item {
    border: 2px solid var(--text-primary) !important;
    background: var(--bg-primary) !important;
  }

  .action-btn {
    border: 2px solid var(--text-primary) !important;
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
  }

  .tag-item {
    border: 1px solid var(--text-primary) !important;
    background: var(--bg-secondary) !important;
  }
}

/* 安全区域适配（iPhone X等） */
@supports (padding: max(0px)) {
  .header-content {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }

  .content-area {
    padding-left: max(2rem, env(safe-area-inset-left)) !important;
    padding-right: max(2rem, env(safe-area-inset-right)) !important;
  }

  .modern-footer {
    padding-left: max(2rem, env(safe-area-inset-left)) !important;
    padding-right: max(2rem, env(safe-area-inset-right)) !important;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
  }
}

/* PWA 状态栏适配 */
@media (display-mode: standalone) {
  .header-content {
    padding-top: env(safe-area-inset-top) !important;
  }

  #globalHeader {
    padding-top: env(safe-area-inset-top) !important;
    height: calc(80px + env(safe-area-inset-top)) !important;
  }

  .main-content {
    padding-top: calc(80px + env(safe-area-inset-top)) !important;
  }
}
